package com.geezdata.cps.sdk3rd.kaola.request;

import java.util.Date;
import java.util.HashMap;
import java.util.Map;

import org.hibernate.validator.constraints.NotBlank;

import com.geezdata.cps.sdk3rd.kaola.constant.Constants;
import com.geezdata.cps.sdk3rd.kaola.response.KaolaOrderSearchResult;

/**
 * 考拉接口：kaola.order.search<br>
 * 根据订单信息查询订单<br>
 * &nbsp;<br>
 * 应用基本输入参数：<br>
 * <li>order_status：int, 必须，订单状态。1(已付款)、2(已发货)、3(已签收)、4(缺货订单)、5(取消待确认)、6(已取消)
 * <li>date_type：int, 必须，搜索日期类型。1(支付时间)、2(发货时间)、3(签收时间)
 * <li>start_time：必须，搜索开始时间。格式为yyyy-MM-dd HH:mm:ss
 * <li>end_time：必须，搜索结束时间。格式为yyyy-MM-dd HH:mm:ss
 * <li>order_id：可选，订单号
 * <li>page_no：可选，开始页。默认为1, 最大为50
 * <li>page_size：可选，一页记录数。默认为20, 最大为100<br>
 * &nbsp;<br>
 *
 */
public class KaolaOrderSearchRequest extends KaolaRequest<KaolaOrderSearchResult> {
	@NotBlank(message = "orderStatus 不能为空！")
    private String orderStatus = null;
    
	@NotBlank(message = "dateType 不能为空！")
    private String dateType = null;
    
	@NotBlank(message = "startTime 不能为空！")
    private String startTime = null;
    
	@NotBlank(message = "endTime 不能为空！")
    private String endTime = null;
    
    private String orderId = null;
    
    private String pageNo = null;
  
    private String pageSize = null;
    
    public KaolaOrderSearchRequest() {
        super();
        methodName = Constants.METHOD_KAOLA_ORDER_SEARCH;
    }
    
    public String getOrderStatus() {
        return orderStatus;
    }

    public void setOrderStatus(String orderStatus) {
        this.orderStatus = orderStatus;
    }

    public String getDateType() {
        return dateType;
    }

    public void setDateType(String dateType) {
        this.dateType = dateType;
    }

    public String getStartTime() {
        return startTime;
    }
    
    public void setStartTime(Date startTime) {
        this.startTime = sdf.format(startTime);
    }

    public void setStartTime(String startTime) {
        this.startTime = startTime;
    }

    public String getEndTime() {
        return endTime;
    }

    public void setEndTime(String endTime) {
        this.endTime = endTime;
    }
    
    public void setEndTime(Date endTime) {
        this.endTime = sdf.format(endTime);
    }

    public String getOrderId() {
        return orderId;
    }

    public void setOrderId(String orderId) {
        this.orderId = orderId;
    }

    public String getPageNo() {
        return pageNo;
    }

    public void setPageNo(String pageNo) {
        this.pageNo = pageNo;
    }

    public String getPageSize() {
        return pageSize;
    }

    public void setPageSize(String pageSize) {
        this.pageSize = pageSize;
    }

    @Override
    public Map<String, Object> getAppParams() {
        Map<String, Object> appParams = new HashMap<String, Object>();
        appParams.put("order_status", orderStatus);
        appParams.put("date_type", dateType);
        appParams.put("start_time", startTime);
        appParams.put("end_time", endTime);
        appParams.put("order_id", orderId);
        appParams.put("page_no", pageNo);
        appParams.put("page_size", pageSize);
        return appParams;
    }

	@Override
	public Class<KaolaOrderSearchResult> getResponseClass() {
		return KaolaOrderSearchResult.class;
	}
}
